from selenium import webdriver
from selenium.webdriver.common.by import By


class Location:
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.driver.get('https://www.baidu.com')
    def ID(self):
        print(self.driver.find_element(By.ID, 'kw').get_attribute('outerHTML'))

    def class1(self):
        print(self.driver.find_element(By.CLASS_NAME, 'quickdelete-line').get_attribute('outerHTML'))

    def Link(self):
        print(self.driver.find_element(By.LINK_TEXT, '贴吧').get_attribute('outerHTML'))

    def Partial(self):
        print(self.driver.find_element(By.PARTIAL_LINK_TEXT, '地').get_attribute('outerHTML'))

    def NAME(self):
        print(self.driver.find_element(By.NAME, 'wd').get_attribute('outerHTML'))

    def Tag(self):
        # print(self.driver.find_element(By.TAG_NAME, 'input').get_attribute('outerHTML'))

        # print(self.input)
        # print(self.input.get_attribute('outerHTML'))
        self.name = self.driver.find_elements(By.TAG_NAME, 'input')
        print(self.name)
        print(len(self.name))
        for init in(self.name):
            print(init.get_attribute('outerHTML'))





    def quit(self):
        self.driver.quit()

if __name__ == '__main__':
    driver = Location()
    # driver.ID()
    # driver.class1()
    # driver.Link()
    # driver.Partial()
    driver.Tag()
    driver.quit()



